#include"process.h"

char str[] = { '|','/','-','\\' };
void process(double rate)
{
  static char bar[SIZE]= { 0  };
  static int cnt = 0;
  int num = strlen(str);
  if(rate >= 0 && rate <= 100)
  {
    cnt++;
    cnt = (cnt >= num?0:cnt);
    printf("\033[34m[%-100s]\033[0m[%.1f%%][%c]\r",bar,rate,str[cnt]);
    fflush(stdout);


   if(rate == 100)
   {
      bar[(int)rate] = '=';
   }
   else
   {
     bar[(int)rate] = BAR_BODY;
     bar[(int)rate+1] = BAR_HEARER;

   }
  }
  
}
